package main

import "fmt"
import "os"

func isShuixian(n int) bool {
	a := n / 100
	b := n % 100 / 10
	c := n % 10
	if a*a*a+b*b*b+c*c*c == n {
		return true
	}
	return false
}
func WriteFile(path string) {
	f, err := os.Create(path)
	if err != nil {
		fmt.Println("打开文件异常")
		return
	}
	fmt.Println("输出判断到flower.txt....")
	for i := 2; i <= 5000; i++ {
		//fmt.Println("i=", i)
		if isShuixian(i) == true {
			buf := fmt.Sprintf("i=%d\n", i)
			f.WriteString(buf)
		}
	}
	fmt.Println("输出完毕")
	defer f.Close()
}
func main() {
	path := "../target/flower.txt"
	WriteFile(path)
}
